package com.wj.ballcat.demo.model.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.tangzc.mpe.actable.annotation.ColumnComment;
import com.tangzc.mpe.actable.annotation.Table;
import com.tangzc.mpe.bind.metadata.annotation.BindEntityByMid;
import com.tangzc.mpe.bind.metadata.annotation.JoinOrderBy;
import com.tangzc.mpe.bind.metadata.annotation.MidCondition;
import lombok.Data;

import java.util.List;


@Data
@Table(comment = "角色信息")
public class DemoRole {

	@ColumnComment("主键")
	private String id;

	@ColumnComment("角色名")
	private String name;

	// @BindEntityByMid是可以实现通过中间表关联数据，主要属性conditions，midEntity指定中间表实体（该实体必须有对应的MP的Mapper），
	//
	@BindEntityByMid(conditions = @MidCondition(
			midEntity = DemoRoleMenu.class, selfMidField = "roleId", joinMidField = "menuId"
	), orderBy = @JoinOrderBy(field = "name"))
	@TableField(exist = false)
	private List<DemoMenu> menus;

	// 省略其他信息
//    .......
}
